/**
 * @author Jeevan Tomson
 * @copyright 2010
 */
 
function submitenter(myfield,e) {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    
    if (keycode == 13) {
       myfield.form.submit();
       return false;
    }
    else
       return true;
}

function setTime() {
    $("#top-clock").html(getTime());
    setTimeout("setTime()",1000);
}

$(document).ready(function () {
    setTimeout("setTime()",1000);
});

// 3 - MESSAGE BOX FADING SCRIPTS ---------------------------------------------------------------------

$(document).ready(function() {
	$(".close-yellow").click(function () {
		$("#message-yellow").fadeOut("slow");
	});
	$(".close-red").click(function () {
		$("#message-red").fadeOut("slow");
	});
	$(".close-blue").click(function () {
		$("#message-blue").fadeOut("slow");
	});
	$(".close-green").click(function () {
		$("#message-green").fadeOut("slow");
	});
});

// END ----------------------------- 3

function setDobCalender(){
    
}

function highlightElement(element, errorClass, validClass) {
    var tag_name = $(element).attr("tagName");
    switch(tag_name)
    {
        case "SELECT":
          //$(element).parent().addClass(errorClass).removeClass(validClass);
          var cDiv = $(element).parent();
          $(cDiv).addClass(errorClass).removeClass(validClass);
          var name = $(element).attr("name");
          $("#error-"+name).removeClass("no-error");
          break;
        case 2:
          break;
        default:
            $(element).addClass(errorClass).removeClass(validClass);
            var name = $(element).attr("name");
            $("#error-"+name).removeClass("no-error");
    }
}


function unhighlightElement(element, errorClass, validClass) {
    var tag_name = $(element).attr("tagName");
    switch(tag_name)
    {
        case "SELECT":
          //$(element).parent().removeClass(errorClass).addClass(validClass);
          var cDiv = $(element).parent();
          $(cDiv).removeClass(errorClass).addClass(validClass);
          var name = $(element).attr("name");
          $("#error-"+name).addClass("no-error");  
          break;
        case 2:
          break;
        default:
            $(element).removeClass(errorClass).addClass(validClass);
            var name = $(element).attr("name");
            $("#error-"+name).addClass("no-error");
            //$(element.form).find("label[for=" + element.id + "]").removeClass(errorClass); 
    }
    
}

function placeError(error, element) {
    var name = element.attr("name");
    //$("#error-"+name).removeClass("no-error");
    var errormessage = error.html();
    $("#error-"+name+" .error-inner").html(errormessage);
    //alert(errormessage);
}